home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / net / readline-2.0mg.tar.gz / readline-2.0mg.tar / readline-2.0mg / rldefs.h < prev    next >
C/C++ Source or Header  |  1994-11-20  |  7KB  |  208 lines

  1. /* rldefs.h -- an attempt to isolate some of the system-specific defines
  2.    for readline.  This should be included after any files that define
  3.    system-specific constants like _POSIX_VERSION or USG. */
  4.  
  5. /* Copyright (C) 1987,1989 Free Software Foundation, Inc.
  6.  
  7.    This file contains the Readline Library (the Library), a set of
  8.    routines for providing Emacs style line input to programs that ask
  9.    for it.
  10.  
  11.    The Library is free software; you can redistribute it and/or modify
  12.    it under the terms of the GNU General Public License as published by
  13.    the Free Software Foundation; either version 1, or (at your option)
  14.    any later version.
  15.  
  16.    The Library is distributed in the hope that it will be useful, but
  17.    WITHOUT ANY WARRANTY; without even the implied warranty of
  18.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  19.    General Public License for more details.
  20.  
  21.    The GNU General Public License is often shipped with GNU software, and
  22.    is generally kept in a file called COPYING or LICENSE.  If you do not
  23.    have a copy of the license, write to the Free Software Foundation,
  24.    675 Mass Ave, Cambridge, MA 02139, USA. */
  25.  
  26. #if !defined (_RLDEFS_H)
  27. #define _RLDEFS_H
  28.  
  29. #if defined (HAVE_CONFIG_H)
  30. #  include "config.h"
  31. #endif
  32.  
  33. #if !defined (PRAGMA_ALLOCA)
  34. #  include "memalloc.h"
  35. #endif
  36.  
  37. #define NEW_TTY_DRIVER
  38. #define HAVE_BSD_SIGNALS
  39. /* #define USE_XON_XOFF */
  40.  
  41. #if defined (__linux__) || defined (HAVE_TERMCAP_H)
  42. #  include <termcap.h>
  43. #endif /* __linux__ || HAVE_TERMCAP_H */
  44.  
  45. /* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
  46. #if defined (USG) && !defined (hpux)
  47. #  undef HAVE_BSD_SIGNALS
  48. #endif
  49.  
  50. /* System V machines use termio. */
  51. #if !defined (_POSIX_VERSION)
  52. #  if defined (USG) || defined (hpux) || defined (Xenix) || defined (sgi) || \
  53.       defined (DGUX) || defined (HAVE_TERMIO_H)
  54. #    undef NEW_TTY_DRIVER
  55. #    define TERMIO_TTY_DRIVER
  56. #    include <termio.h>
  57. #    if !defined (TCOON)
  58. #      define TCOON 1
  59. #    endif
  60. #  endif /* USG || hpux || Xenix || sgi || DUGX || HAVE_TERMIO_H */
  61. #endif /* !_POSIX_VERSION */
  62.  
  63. /* Posix systems use termios and the Posix signal functions. */
  64. #if defined (_POSIX_VERSION)
  65. #  if !defined (TERMIOS_MISSING)
  66. #    undef NEW_TTY_DRIVER
  67. #    define TERMIOS_TTY_DRIVER
  68. #    include <termios.h>
  69. #  endif /* !TERMIOS_MISSING */
  70. #  define HAVE_POSIX_SIGNALS
  71. #  if !defined (O_NDELAY)
  72. #    define O_NDELAY O_NONBLOCK    /* Posix-style non-blocking i/o */
  73. #  endif /* O_NDELAY */
  74. #endif /* _POSIX_VERSION */
  75.  
  76. /* System V.3 machines have the old 4.1 BSD `reliable' signal interface. */
  77. #if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
  78. #  if defined (USGr3) && !defined (XENIX_22)
  79. #    if !defined (HAVE_USG_SIGHOLD)
  80. #      define HAVE_USG_SIGHOLD
  81. #    endif /* !HAVE_USG_SIGHOLD */
  82. #  endif /* USGr3 && !XENIX_22 */
  83. #endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
  84.  
  85. /* Other (BSD) machines use sgtty. */
  86. #if defined (NEW_TTY_DRIVER)
  87. #  include <sgtty.h>
  88. #endif
  89.  
  90. /* Define _POSIX_VDISABLE if we are not using the `new' tty driver and
  91.    it is not already defined.  It is used both to determine if a
  92.    special character is disabled and to disable certain special
  93.    characters.  Posix systems should set to 0, USG systems to -1. */
  94. #if !defined (NEW_TTY_DRIVER) && !defined (_POSIX_VDISABLE)
  95. #  if defined (_POSIX_VERSION)
  96. #    define _POSIX_VDISABLE 0
  97. #  else /* !_POSIX_VERSION */
  98. #    define _POSIX_VDISABLE -1
  99. #  endif /* !_POSIX_VERSION */
  100. #endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
  101.  
  102. #if !defined (SHELL) && (defined (_POSIX_VERSION) || defined (USGr3))
  103. #  if !defined (HAVE_DIRENT_H)
  104. #    define HAVE_DIRENT_H
  105. #  endif /* !HAVE_DIRENT_H */
  106. #endif /* !SHELL && (_POSIX_VERSION || USGr3) */
  107.  
  108. #if defined (HAVE_DIRENT_H)
  109. #  include <dirent.h>
  110. #  define D_NAMLEN(d) strlen ((d)->d_name)
  111. #else /* !HAVE_DIRENT_H */
  112. #  define D_NAMLEN(d) ((d)->d_namlen)
  113. #  if defined (USG)
  114. #    if defined (Xenix)
  115. #      include <sys/ndir.h>
  116. #    else /* !Xenix (but USG...) */
  117. #      include "ndir.h"
  118. #    endif /* !Xenix */
  119. #  else /* !USG */
  120. #    include <sys/dir.h>
  121. #  endif /* !USG */
  122. #  if !defined (dirent)
  123. #    define dirent direct
  124. #  endif /* !dirent */
  125. #endif /* !HAVE_DIRENT_H */
  126.  
  127. #if defined (USG) && defined (TIOCGWINSZ) && !defined (Linux)
  128. #  if defined (HAVE_SYS_STREAM_H)
  129. #    include <sys/stream.h>
  130. #  endif /* HAVE_SYS_STREAM_H */
  131. #  if defined (HAVE_SYS_PTEM_H)
  132. #    include <sys/ptem.h>
  133. #  endif /* HAVE_SYS_PTEM_H */
  134. #  if defined (HAVE_SYS_PTE_H)
  135. #    include <sys/pte.h>
  136. #  endif /* HAVE_SYS_PTE_H */
  137. #endif /* USG && TIOCGWINSZ && !Linux */
  138.  
  139. /* Posix macro to check file in statbuf for directory-ness.
  140.    This requires that <sys/stat.h> be included before this test. */
  141. #if defined (S_IFDIR) && !defined (S_ISDIR)
  142. #  define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
  143. #endif
  144.  
  145. /* Decide which flavor of the header file describing the C library
  146.    string functions to include and include it. */
  147.  
  148. #if defined (USG) || defined (NeXT)
  149. #  if !defined (HAVE_STRING_H)
  150. #    define HAVE_STRING_H
  151. #  endif /* !HAVE_STRING_H */
  152. #endif /* USG || NeXT */
  153.  
  154. #if defined (HAVE_STRING_H)
  155. #  include <string.h>
  156. #else /* !HAVE_STRING_H */
  157. #  include <strings.h>
  158. #endif /* !HAVE_STRING_H */
  159.  
  160. #if !defined (strchr) && !defined (__STDC__)
  161. extern char *strchr (), *strrchr ();
  162. #endif /* !strchr && !__STDC__ */
  163.  
  164. #if defined (HAVE_VARARGS_H)
  165. #  include <varargs.h>
  166. #endif /* HAVE_VARARGS_H */
  167.  
  168. /* This is needed to include support for TIOCGWINSZ and window resizing. */
  169. #if defined (OSF1) || defined (BSD386) || defined (NetBSD) || \
  170.     defined (__BSD_4_4__) || defined (FreeBSD) || defined (_386BSD) || \
  171.     defined (AIX)
  172. #  define GWINSZ_IN_SYS_IOCTL
  173. #endif
  174.  
  175. #if !defined (emacs_mode)
  176. #  define no_mode -1
  177. #  define vi_mode 0
  178. #  define emacs_mode 1
  179. #endif
  180.  
  181. /* If you cast map[key].function to type (Keymap) on a Cray,
  182.    the compiler takes the value of map[key].function and
  183.    divides it by 4 to convert between pointer types (pointers
  184.    to functions and pointers to structs are different sizes).
  185.    This is not what is wanted. */
  186. #if defined (CRAY)
  187. #  define FUNCTION_TO_KEYMAP(map, key)    (Keymap)((int)map[key].function)
  188. #  define KEYMAP_TO_FUNCTION(data)    (Function *)((int)(data))
  189. #else
  190. #  define FUNCTION_TO_KEYMAP(map, key)    (Keymap)(map[key].function)
  191. #  define KEYMAP_TO_FUNCTION(data)    (Function *)(data)
  192. #endif
  193.  
  194. #ifndef savestring
  195. extern char *xmalloc ();
  196. #define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
  197. #endif
  198.  
  199. /* Possible values for _rl_bell_preference. */
  200. #define NO_BELL 0
  201. #define AUDIBLE_BELL 1
  202. #define VISIBLE_BELL 2
  203.  
  204. /* CONFIGURATION SECTION */
  205. #include "rlconf.h"
  206.  
  207. #endif /* !_RLDEFS_H */
  208.